﻿//文件指定编译编码UTF-8
#pragma execution_character_set("utf-8")

/**
*    @file:    onlineusercontroller.cpp
*    @brief:
*    @author:  sanshi522@163.com
*    @date:    2025-03-22  11:44
*/
#include "onlineusercontroller.h"
#include <responesutils.h>

OnlineUserController::OnlineUserController(QObject *parent) : HttpRequestHandler(parent)
{

}

OnlineUserController::~OnlineUserController()
{

}

void OnlineUserController::service(HttpRequest &request, HttpResponse &response)
{
    QString path = request.getPath();
    QStringList pathList = path.split("/");
    if (pathList.size() < 3)
    {
        this->returnError(response);
        return;
    }
    QString method = pathList.value(3);
    QByteArray responseMsg;
    QString methodType = request.getMethod();

    qDebug() << __FUNCTION__ << methodType;

    if (methodType == "GET")
    {
        if (method == "userlist")
        {
            return getUserList(request, response);
        }
    }
    this->returnError(response);
}

void OnlineUserController::getUserList(HttpRequest &request, HttpResponse &response)
{
    return ResponesUtils::erroResponse(response,"未开发完成");
}
